from whiff.middleware import misc
from whiff import resolver

class argSource(misc.utility):
    def __init__(self,
                 page):
        self.page = page
    def __call__(self, env, start_response):
        try:
            pageArg = self.page.arguments["page"]
            pageSrc = pageArg.text
        except "bogus":
            pageSrc = self.param_text(self.page)
        return self.deliver_page(pageSrc, env, start_response)

__middleware__ = argSource
